Chai: Traits for Java-Like Languages
نویسندگان
چکیده
Traits support the factoring out of common behaviour, and its integration into classes in a manner that coexists smoothly with inheritance-based structuring mechanisms. We designed the language Chai , which incorporates statically typed traits into a simple Java-inspired base language, and we discuss three versions of the language: Chai1, where traits are only a mechanism for the creation of classes; Chai2 where traits are a mechanism for the creation of classes, and can also introduce types, and Chai3 where traits play a role at runtime, and can can be applied to objects, and change the objects’ behaviour. We give formal models for these languages, outline the proof of soundness, and our prototype implementation.
منابع مشابه
Adding Traits to (Statically Typed) Languages
Traits offer a fine-grained mechanism for composing classes in object-oriented languages from reusable components, while avoiding the fragility problems introduced by multiple inheritance and mixins. Although traits were developed in the context of dynamically typed languages, they would also offer clear benefits for statically typed languages like Java and C#. This report summarizes the issues...
متن کاملFlattening Traits
Traits are fine-grained components that can be used to compose classes, while avoiding many of the problems of multiple inheritance and mixin-based approaches. Since most implementations of traits have focused on dynamically-typed languages, the question naturally arises, how can one best introduce traits to statically-typed languages, like Java and C#? In this paper we argue that the flattenin...
متن کاملAbstract Type Constructors for Java-like Languages
Type Constructors for Java-like Languages Philippe Altherr and Vincent Cremet
متن کاملTraitRecordJ: A programming language with traits and records
Traits have been designed as units for fine-grained reuse of behavior in the object-oriented paradigm. Records have been devised to complement traits for fine-grained reuse of state. In this paper, we present the language TRAITRECORDJ, a JAVA dialect with records and traits. Records and traits can be composed by explicit linguistic operations, allowing code manipulations to achieve fine-grained...
متن کاملMultivariate Analysis of Morphological Traits of Local Goats in Central Java, Indonesia
The objective of this research was to discriminate four local breeds of goat in Central Java-Indonesia using multivariate analysis. Data from eight morphological traits of four goat breeds, namely Kejobong goat (JG), Etawa Grade goat (EGG), Kacang goat (KG) and Jawarandu goat (RG) originated from Purbalingga, Purworejo, Grobogan and Pemalang regencies, respectively, were used. One hundred and s...
متن کامل